import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from '@/store'
Vue.config.productionTip = false
// 引入swiper的css
import 'swiper/css/swiper.css'

// 注册三级联动全局组件
import TypeNav from '@/components/TypeNav'
Vue.component(TypeNav.name, TypeNav)
// 轮播图的全局组件
import BannerImg from "@/components/Banner"
Vue.component(BannerImg.name,BannerImg)
// 引入分页器的全局组件
import Pagination from '@/components/Pagination'
Vue.component(Pagination.name, Pagination)

// 引入mock数据
import '@/mock/mockServer'

// 引入所有的封装的requests请求
import * as requests from '@/api/request'
Vue.prototype.$API = requests

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI)

// 引入图片懒加载插件
import VueLazyload from 'vue-lazyload'
Vue.use(VueLazyload,{
  // 懒加载默认图
  loading:require('@/assets/loading.gif')
})

new Vue({
  render: h => h(App),
  // 全局事件总线
  beforeCreate(){
    Vue.prototype.$bus = this
    Vue.prototype.$http = requests
  },
  router,
  store
}).$mount('#app')
